# gfxwptqufowqhdjj

# coding=utf-8
import smtplib
from datetime import date, datetime
from email.mime.text import MIMEText

from zc_core.util.common import format_time

msg_from = '1600451817@qq.com'
msg_to = '461714283@qq.com'
pwd = 'gfxwptqufowqhdjj'


def send_mail(subject="采集失败[%s]", content=""):
    msg = MIMEText(content)
    msg['Subject'] = subject
    msg['From'] = msg_from
    msg['To'] = msg_to

    try:
        s = smtplib.SMTP_SSL("smtp.qq.com", 465)  # 邮件服务器及端口号
        s.login(msg_from, pwd)
        s.sendmail(msg_from, msg_to, msg.as_string())
        print("发送成功")
    except(smtplib.SMTPException) as e:
        print(e.message)
    finally:
        s.quit()


if __name__ == '__main__':
    send_mail(subject="采集失败[%s]" % format_time(datetime.now()))
